package cn.seqdata.rpt.column;

import java.util.Objects;

public interface ColumnVals {
	Number[] vals();

	default Number getTotal() {
		double total = 0.0d;

		for (int i = 0; i < vals().length; ++i) {
			Number val = vals()[i];
			if (Objects.nonNull(val)) {
				if (Double.isFinite(val.doubleValue())) {
					total += val.doubleValue();
				}
			}
		}

		return total;
	}
}
